#include<stdio.h>
#include<string.h>
#include<stdlib.h>

void move(int n,char init,char dest,char add){

    if(n == 1){

        printf("move 1 from %c to dest %c.\n",init,dest);
        return;
    }
    move(n-1,init,add,dest);
    printf("move %d from %c to dest %c.\n",n,init,dest);
    move(n-1,add,dest,init);
}

int
main(int argc,char * argv[]){

    if(argc < 2){
        printf("need 1 position integer.\n");
        return EXIT_FAILURE;
    }
    int n = (int)strtol(argv[1],NULL,10);
    // check n
    if(n <= 0){

        printf("has 1 position number.\n");
        return EXIT_FAILURE;
    }
    move(n,'A','B','C');
    return 0;
}